////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                                            //
//                                                         WNProject                                                          //
//                                                                                                                            //
//            This file is distributed under the BSD 2-Clause open source license. See License.txt for details.               //
//                                                                                                                            //
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#ifndef __WN_FUNCTION_HEADER_LIST_H__
#define __WN_FUNCTION_HEADER_LIST_H__

#include "WNScripting/inc/WNParseNode.h"
#include "WNScripting/inc/WNIdentifierMap.h"
#include "WNScripting/inc/WNTypeManager.h"

class WNDataType;

class WNFunctionHeaderList : public WNParseNode {
public:
    struct WNFunctionVal {
        WNIdentifierElement mIdentifier;
        WNTypeElement mDataType;
    };

    virtual ~WNFunctionHeaderList();

    WNFunctionHeaderList(WN_SIZE_T _startLine,
                         WN_SIZE_T _endLine,
                         WN_SIZE_T _startChar,
                         WN_SIZE_T _endChar,
                         WNDataType* _dataType,
                         WNIdentifierElement _elem);

    WNFunctionHeaderList(WN_SIZE_T _startLine,
                         WN_SIZE_T _endLine,
                         WN_SIZE_T _startChar,
                         WN_SIZE_T _endChar,
                         WNDataType* _dataType,
                         WNIdentifierElement _elem,
                         WNFunctionHeaderList* _fSubList);

    llvm::Value* OptimizeAndGenerate(WNScriptingEngineData& _scriptingData, WNFunctionDecl* _functionDecl);
    const std::vector<WNFunctionVal>& GetFunctionParameters();

private:
    WN_VOID OptimizeAndGeneratePrivate(WNScriptingEngineData& _scriptingData, WNFunctionDecl* _functionDecl, std::vector<WNFunctionVal>& _fillList);
    std::vector<WNFunctionVal> mFunctionVals;
    WNDataType* mDataType;
    WNIdentifierElement mIdentifier;
    WNFunctionHeaderList* mSubList;
};

#endif // __WN_FUNCTION_HEADER_LIST_H__